﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;

namespace IntelligentMonitor.Controllers
{
    [Authorize]
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }
        public IActionResult Back()
        {
            return View();
        }

        public IActionResult OnReport()
        {
            return View();
        }

        [HttpPost]
        public  IActionResult OnReport(string s1 ,string s2)
        {
            Random r = new Random();
            var i1 = r.Next(1, 20);
            var i2 = r.Next(1, 20);
            var i3 = r.Next(1, 20);
            var i4 = r.Next(1, 20);
            var result = Json("[{ \"value\": "+ i1 + ", \"name\": \"模块1\" },{ \"value\": " + i2 + ", \"name\": \"模块2\" },{ \"value\": " + i3 + ", \"name\": \"模块3\" },{ \"value\": " + i4 + ", \"name\": \"模块4\" }]");
            return result;
        }

        public IActionResult GetOnReport()
        {
            Random r = new Random();
            var i1 = r.Next(1, 20);
            var i2 = r.Next(1, 20);
            var i3 = r.Next(1, 20);
            var i4 = r.Next(1, 20);
            var i5 = r.Next(1, 20);
            var i6 = r.Next(1, 20);
            var i7 = r.Next(1, 20);
            var result = Json("[{ \"value\":" + i1 + ", \"date\": \"2020/04/09\" },{ \"value\": " + i2 + ", \"date\": \"2020/04/09\" }," +
                "{ \"value\":" + i3 + ", \"date\": \"2020/04/09\" },{ \"value\": " + i4 + ", \"date\": \"2020/04/09\" },{ \"value\": " + i5 +
                ", \"date\": \"2020/04/09\" },{ \"value\": " + i6 + ", \"date\": \"2020/04/09\" },{ \"value\": " + i7 + ", \"date\": \"2020/04/09\" }]");
            return result;
        }

        [HttpPost]
        public IActionResult OnReport1(string s1)
        {
            Random r = new Random();
            var i1 = r.Next(1000, 2000);
            var i2 = r.Next(1000, 2000);
            var i3 = r.Next(1000, 2000);
            var i4 = r.Next(1000, 2000);
            var result = Json("[{ \"value\": " + i1 + ", \"name\": \"模块1\" },{ \"value\": " + i2 + ", \"name\": \"模块2\" },{ \"value\": " + i3 + ", \"name\": \"模块3\" }]");
            return result;
        }

        public IActionResult SeReport()
        {
            return View();
        }

        public IActionResult ThReport()
        {
            return View();
        }

        public IActionResult FoReport()
        {
            return View();
        }
        public IActionResult FiReport()
        {
            return View();
        }
        public IActionResult SiReport()
        {
            return View();
        }
        public IActionResult SvReport()
        {
            return View();
        }
    }
}